package org.bigjava.biz.impl;

import org.bigjava.bean.Tzgg;
import org.bigjava.biz.TzggService;
import org.bigjava.mapper.TzggMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service("tzggService")
public class TzggServiceImpl implements TzggService {

    @Qualifier("tzggMapper")
    @Autowired
    TzggMapper tzggMapper;

    //根据标题或者内容搜索公告
    @Override
    public List<Tzgg> tzggSouSuo(String title, String content) {
        return tzggMapper.tzggSouSuo(title,content);
    }

    //修改公告
    @Override
    public int tzggXiuGai(Tzgg tzgg) {
        return tzggMapper.tzggXiuGai(tzgg);
    }

    //发布公告
    @Override
    public int tzggAdd(Tzgg tzgg) {
        Date date = new Date();
        tzgg.setFbsj(date);
        return tzggMapper.tzggAdd(tzgg);
    }
    //假删除公告
    @Override
    public int tzggShanChu(int id) { return tzggMapper.tzggShanChu(id); }
    //根据id查询公告信息
    @Override
    public Tzgg tzggId(int id) { return tzggMapper.tzggId(id); }
    //公告总数
    @Override
    public int tzggZong() {
        return tzggMapper.tzggZong();
    }
    //分页查询公告
    @Override
    public List<Tzgg> tzggFenYe(int offset, int length) {
        return tzggMapper.tzggFenYe(offset,length);
    }
}
